/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('dop', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetOssMetaDownloadRequest {
  ds?: string(name='ds', example='20221226'),
  expire?: long(name='expire', example='3600'),
  tableName?: string(name='tableName', example='dwd_ump_log_uapp_event_json_di'),
}

model GetOssMetaDownloadResponseBody = {
  code?: long(name='Code', example='200'),
  data?: [ string ](name='Data', example='https://ump-dc.oss-cn-beijing.aliyuncs.com/4787165528263387359/umeng/dwd_ump_log_uweb_event_di/ds%3D20220725/4d37337_6_10A60974.orc?Expires=1672139018&OSSAccessKeyId=TMP.3Kfn35DYBphrFfjG5mys6Xe9YPmH2y86hNENwkHKywMjyxRjZwMCTuaTRMuEXovEAsrsss6RoULqsHReJoS3vsdVyqW7YY&Signature=6i5udRnsa6P4uEARdGsSYW8NiBU%3D'),
  errorCode?: string(name='ErrorCode', example='SysErr'),
  msg?: string(name='Msg', example='系统错误'),
  requestId?: string(name='RequestId', example='2127968716722315678728318eaf15'),
  success?: boolean(name='Success', example='True'),
}

model GetOssMetaDownloadResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetOssMetaDownloadResponseBody(name='body'),
}

async function getOssMetaDownloadWithOptions(request: GetOssMetaDownloadRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetOssMetaDownloadResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ds)) {
    query['ds'] = request.ds;
  }
  if (!Util.isUnset(request.expire)) {
    query['expire'] = request.expire;
  }
  if (!Util.isUnset(request.tableName)) {
    query['tableName'] = request.tableName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetOssMetaDownload',
    version = '2022-11-30',
    protocol = 'HTTPS',
    pathname = `/dop/getOssMetaDownload`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOssMetaDownload(request: GetOssMetaDownloadRequest): GetOssMetaDownloadResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getOssMetaDownloadWithOptions(request, headers, runtime);
}

model GetOssMetaListRequest {
  end?: string(name='end', example='20221228'),
  start?: string(name='start', example='20221228'),
  tableName?: string(name='tableName', example='dwd_ump_log_uapp_event_json_di'),
}

model GetOssMetaListResponseBody = {
  code?: long(name='Code', example='200'),
  data?: [ 
    {
      ds?: string(name='ds', example='20221226'),
      fileNames?: [ string ](name='fileNames'),
      fileSize?: string(name='fileSize', example='12345'),
      rows?: string(name='rows', example='100'),
    }
  ](name='Data', example='[     {         "fileSize": "6742533118",         "rows": "60183883",         "class": "com.alibaba.umeng.deliver.dto.FileMetaDTO",         "fileNames": [           "4787160477371098888/umeng/dwd_ump_log_uapp_event_json_di/ds=20221226/59f27cc_111_2B642148.orc"         ],         "ds": "20221226"     } ]'),
  errorCode?: string(name='ErrorCode', example='SysErr'),
  msg?: string(name='Msg', example='系统错误'),
  requestId?: string(name='RequestId', example='2127968716722315678728318eaf15'),
  success?: boolean(name='Success', example='True'),
}

model GetOssMetaListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetOssMetaListResponseBody(name='body'),
}

async function getOssMetaListWithOptions(request: GetOssMetaListRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetOssMetaListResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }
  if (!Util.isUnset(request.tableName)) {
    query['tableName'] = request.tableName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetOssMetaList',
    version = '2022-11-30',
    protocol = 'HTTPS',
    pathname = `/dop/getOssMetaList`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOssMetaList(request: GetOssMetaListRequest): GetOssMetaListResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getOssMetaListWithOptions(request, headers, runtime);
}

model SubmitBackfill4ApiRequest {
  end?: string(name='end', example='20221228'),
  packageId?: int32(name='packageId', example='1'),
  start?: string(name='start', example='20221228'),
}

model SubmitBackfill4ApiResponseBody = {
  code?: long(name='Code', description='code', example='200'),
  data?: string(name='Data', description='data', example='数据结果'),
  errorCode?: string(name='ErrorCode', example='SysErr'),
  msg?: string(name='Msg', example='系统错误'),
  requestId?: string(name='RequestId', description='requestId', example='2131048516722814109054848e9249'),
  success?: boolean(name='Success', description='success', example='True'),
  dyCode?: string(name='dyCode', example='BizErr.411'),
  dyMessage?: string(name='dyMessage'),
}

model SubmitBackfill4ApiResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SubmitBackfill4ApiResponseBody(name='body'),
}

async function submitBackfill4ApiWithOptions(request: SubmitBackfill4ApiRequest, headers: map[string]string, runtime: Util.RuntimeOptions): SubmitBackfill4ApiResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.end)) {
    query['end'] = request.end;
  }
  if (!Util.isUnset(request.packageId)) {
    query['packageId'] = request.packageId;
  }
  if (!Util.isUnset(request.start)) {
    query['start'] = request.start;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SubmitBackfill4Api',
    version = '2022-11-30',
    protocol = 'HTTPS',
    pathname = `/dop/submitBackfill4Api`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function submitBackfill4Api(request: SubmitBackfill4ApiRequest): SubmitBackfill4ApiResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return submitBackfill4ApiWithOptions(request, headers, runtime);
}

